using System.Collections.Generic;
using System.Linq;
using FluentParser.Expressions;

namespace FluentParser
{
    /// <summary>
    /// Resulting object of the grammar's parsing of a text.
    /// Contains a list of warnings and errors.
    /// </summary>
    /// <typeparam name="TR">Type of the resulting value</typeparam>
    public class GrammarResult<TR> : ParsingResult<TR>
    {
        /// <summary>
        /// List of errors encountered during a parsing session.
        /// </summary>
        public List<ParsingException> Errors { get; private set; }

        public GrammarResult(ParsingResult<TR> source, IEnumerable<ParsingException> errors)
            : base(source.Index, source.Length, source.Value)
        {
            Errors = errors.ToList();
        }
    }
}